// Tierless
// Copyright © 2010 Alphora
// This file is licensed under a modified BSD-license (see tierless_license.txt).
using System.Runtime.Serialization;

namespace Tierless.Framework.EntityTypes
{
	/// <summary>
	/// Represents a default definition that can be associated with a column.
	/// </summary>
	[DataContract]
	public class EntityTypeColumnDefault : NamedEntityTypeObject
	{
		/// <summary>
		/// Initializes a new instance of the EntityTypeColumnDefault class.
		/// </summary>
		/// <param name="defaultValue">The default value.</param>
		public EntityTypeColumnDefault(object defaultValue)
			: base("Default")
		{
			_defaultValue = defaultValue;
		}

		/// <summary>
		/// Initializes a new instance of the EntityTypeColumnDefault class.
		/// </summary>
		public EntityTypeColumnDefault()
			: this(null)
		{}

		private object _defaultValue;

		/// <summary>
		/// Gets or sets the value for the default.
		/// </summary>
		[DataMember]
		public object DefaultValue
		{
			get { return _defaultValue; }
			set { _defaultValue = value; }
		}

		/// <summary>
		/// Gets the value for the default.
		/// </summary>
		/// <returns>The value for the default.</returns>
		public virtual object GetDefaultValue()
		{
			return _defaultValue;
		}
	}
}